---
category: DOM
created: '2020-04-19'
title: Redirect to another page
updated: '2021-10-13'
---

**JavaScript version**

```js goTo.js
const goTo = (url) => (location.href = url);
```

**TypeScript version**

```ts goTo.ts
const goTo = (url: string): string => (location.href = url);
```
